﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;



namespace UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        MainViewModel m = new MainViewModel();
        public MainWindow()
        {
            
           
            InitializeComponent();
            DataContext = m;
        }
        public void Drowing()
        {
            System.Windows.Controls.Image frame = m.GeneratePicture((int)CanvasGame.ActualWidth, (int)CanvasGame.ActualHeight);
            CanvasGame.Children.Clear();
            CanvasGame.Children.Add(frame);
        }
        private void IfKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Right:
                case Key.Left:
                case Key.Up:
                case Key.Down:
                    m.PlayerMove(e.Key);
                    Drowing();
                    break;
                case Key.Escape:
                    Close();
                    break;
                case Key.R:
                    m.CreateMatrix(250, 250);
                    Drowing();
                    break;
            }
        }
    }
}
